<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>${sessionScope.user.userName}的收藏夹</title>
    <link rel="shortcut icon" type="image/x-icon" href="/static/img/index/favicon.png">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/public.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/nav.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/iconFont/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/css/user/shop_collect_list.css"/>
</head>
<body>

<!--nav start-->
<jsp:include page="${pageContext.request.contextPath}/public_page/nav.jsp"></jsp:include>
<div style="width: 100%; height: 6px; background-color: #F2F2F2"></div>
<!-- nav end-->
<div id="fav-tab">
    <div id="fav-tab-bd">
        <div data-spm="1997992801" id="fav-tab-menu" class="clearfix floatleft">
            <a aria-label="您可以使用tab键寻找您的收藏" class="fav-logo" href="#">
                <img aria-label="欢迎访问淘宝收藏夹" src="//img.alicdn.com/tps/i1/T1gbUrFeVaXXXO7MrX-136-28.png">
            </a>
            <a class="item-page" href="/user/baby_collect_list.htm" data-spm="d4919241">宝贝收藏</a>
            <a class="shop-page current" href="/user/shop_collect_list.htm" data-spm="">店铺收藏</a>
            <div class="more-list J_FavTabMore hidden">
                <a class="buyed-page " target="_blank" href="/bought_shop_list.htm?itemtype=0" data-spm="">
                    购买过的店铺
                    <i class="i"></i>
                </a>
                <div class="more-popup">
                    <ul>
                        <li class="more-item">
                            <a class="tab-link" target="_blank" href="//trade.taobao.com/trade/itemlist/list_bought_items.htm" data-spm="d4919253">已买到的宝贝</a>
                        </li>
                        <li class="more-item">
                            <a class="tab-link" target="_blank" href="//lu.taobao.com/newMyPath.htm" data-spm="d4919261">我的足迹</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="fav-search" data-spm="">
            <div class="search " id="J_Search" role="search">
                <div class="search-panel search-sns-panel-field">
                    <form class="search-panel-focused" id="J_TSearchForm" name="search" action="/search_product.htm" target="_top">
                        <input name="_tb_token_" type="hidden" value="fe6661bbee53b">
                        <div class="search-button">
                            <button type="submit" class="btn-search">搜 索</button>
                        </div>
                        <div class="search-panel-fields">
                            <div class="search-combobox" id="ks-component117">
                                <div class="search-combobox-input-wrap">
                                    <input id="enter" name="enter" accesskey="s" autocomplete="off"
                                           x-webkit-speech="" x-webkit-grammar="builtin:translate" value="" aria-label="搜索全网请输入搜索文字或从搜索历史中选择"
                                           aria-haspopup="true" aria-combobox="list" role="combobox" class="search-combobox-input"></div>
                            </div>
                        </div>
                        <input id="J_SearchSpm" type="hidden" name="spm" value="">
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="mercury-cont">
<%-- 如果没有数据 空状态--%>
        <div class="fav-floatbar">
            <div class="fav-bar-height">
                <div class="fav-bar-float">
                    <div class="fav-bar-float-layout clearfix">
                        <div class="fav-select" data-spm="1997985009">
                            <ul>
                                <li class="fav-sel-item fav-sel-item-first J_SelItemsTags ">
		                    <span class="fav-sel-link fav-sel-select">
		                        全部店铺
		                    <em>${fn:length(shopProduct)}</em>
		                    </span>
                                </li>
                            </ul>
                        </div>
                        <div class="fav-search fav-search-in-shop cleatfix">
                            <form class="fav-search-panel-focused fav-search-in-shop-form" id="J_FavSearchForm" name="favsearch" action="?" target="_top">
                                <div class="fav-search-panel-fields">
                                    <input id="fav-q" name="keyword" accesskey="s" autocomplete="off" x-webkit-speech="" x-webkit-grammar="builtin:translate" placeholder="请输入搜索关键词" value="${param.keyword}" aria-haspopup="true" aria-combobox="list" role="combobox" class="search-combobox-input" aria-label="输入关键词搜索收藏夹内的店铺">
                                </div>
                                <div class="fav-search-button">
                                    <button type="submit" class="fav-btn-search fav-btn-search-s">搜店铺</button>
                                </div>
                            </form>
                            <style>.fav-floatbar .fav-search-in-shop { width: 185px; }</style>
                        </div>
                        <div class="fav-tools" data-spm="1997985013">
                            <div class="J_FavTools_Open fav-tool-showbtn" data-spm-click="gostr=/tbscj;locaid=d1open">
                                批量管理
                            </div>
                            <ul class="fav-tool-list">
                                <li class="fav-tool-item J_SelectAll" data-spm-click="gostr=/tbscj;locaid=d1all">
                                    <i class="icon-selall"></i>
                                    全选
                                </li>
                                <li class="fav-tool-item J_DeleteItems" data-spm-click="gostr=/tbscj;locaid=d1del">
                                    <i class="icon-delitem"></i>
                                    删除
                                </li>
                                <li class="fav-tool-item J_FavTools_Close fav-tool-hidebtn" data-spm-click="gostr=/tbscj;locaid=d1close">取消管理</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    <c:if test="${fn:length(shopProduct) < 1}" var="emptyResult">
        <div class="fav-list">
            <div class="no-fav-result clearfix">
                <div class="no-pic">
                    <img src="//img.alicdn.com/tps/i2/TB16ztmHFXXXXX7XFXXIrnAJFXX-89-89.png">
                </div>
                <div class="no-result-tips">
                    <p class="big-font">你还没收藏过店铺或者查找失败了哦</p>
                    <p><a target="_blank" href="/">去随便逛逛吧</a>，看看有没有喜欢的</p>
                </div>
            </div>
        </div>
    </c:if>
    <div id="fav-list">
        <ul class="img-shop-list J_FavList clearfix">
            <c:forEach items="${shopProduct}" var="shop" varStatus="vs">
                <li class="   J_FavListItem fav-shop " data-sid="${shop.key.shop.id}" data-clid="${shop.key.id}">
                    <div class="shop-card clcearfix">
                        <div class="logo">
                            <a href="/shop/view_shop.htm?brandId=${shop.key.shop.id}" target="_blank">
                                <img class="logo-img" src="${fn:length(shop.key.shop.shopHead) > 0?'/static/seller/shop/'+=shop.key.shop.shopHead:''}">
                            </a>
                        </div>
                        <div class="shop-name">
                            <a class="jpmjicon-box"><img class="jpmjicon" src="//img.alicdn.com/tps/i1/TB1MvqsFVXXXXbPXpXXQkCwFXXX-15-16.png"></a>
                            <a class="shop-name-link" title="${shop.key.shop.shopName}" target="_blank" href="/shop/view_shop.htm?brandId=${shop.key.shop.id}">${shop.key.shop.shopName}</a>
                            <span class="ww-light ww-small"><a href="https://amos.alicdn.com/getcid.aw?v=3&amp;groupid=0&amp;s=1&amp;charset=utf-8&amp;uid=wangdapai_33&amp;site=cntaobao&amp;fromid=cntaobaotb770629195" target="_blank" class="ww-inline ww-online" title="点此可以直接和卖家交流选好的宝贝，或相互交流网购体验，还支持语音视频噢。"><span>旺旺在线</span></a></span>
                            <span class="buyed"></span>
                        </div>
                        <div class="shop-tools">
                            <div class="shop-tools-icon">
                                <a>
                                    <i class="iconfont icon-shanchu"></i>
                                </a>
                            </div>
                        </div>
                    </div>
                    <div class="item-list-box">
                        <ul class="item-list-ul clearfix">
                            <c:forEach items="#{shop.value}" var="product" varStatus="vs2">
                                <li class="item-box g-s-item">
                                    <div class="item J_ItemPriceBox item-price-box">
                                        <a href="//item.taobao.com/item.htm?id=628149767227&amp;scm=" target="_blank" title="${product.productName}">
                                            <img style=" max-height: 100px; max-width: 100px;" class="item-img" src="${product.productImages.get(0).imagePath}" alt="${product.productName}">
                                        </a>
                                        <div class="item-price-pop">
                                            <div class="g_price-box">
                                                <div class="g_price">
                                                    <span>¥</span>
                                                    <strong>${product.nowPrice}</strong>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </li>
                            </c:forEach>
                        </ul>
                    </div>
                    <div class="edit-pop">
                        <div class="edit-pop-bg"></div>
                        <div class="edit-pop-border"></div>
                        <div class="edit-pop-btn J_Edit_Pop_Btn">
                            <i class="edit-icon"></i>
                            <div class="item-pk-txt J_Item_PKtxt"></div>
                        </div>
                    </div>
                    <div class="del-pop">
                        <div class="del-pop-bg"></div>
                        <div class="del-pop-box">
                            <div class="txt">确定删除？</div>
                            <div class="btns">
                                <div class="J_DeleteItem_Ok btn-ok">确定</div>
                                <div class="J_DeleteItem_Close btn-close">取消</div>
                            </div>
                        </div>
                    </div>
                </li>
            </c:forEach>
        </ul>
    </div>
    <div class="page-nav-box-none"></div>
    <div class="page-footer-hidden">
        <div class="J_guess-you-like"style="display: none;"></div>
        <div class="fav-zuanshi">
            <div id="zuanshiAds">
                <ul class="zuanshi-ads-trigger">
                    <li class="on ks-switchable-trigger-internal22"></li>
                </ul>
                <ul class="zuanshi-ads-content">
                </ul>
            </div>
        </div>
    </div>
    <div id="ks-component353" class="fpublictips-overlay" style="width: 328px; height: 197px; z-index: 20010; left: 786.5px; top: 159.01px; display: none;">
        <div id="ks-content-ks-component354" class="fpublictips-overlay-content">
            <a class="J_FPublicTips_Close fpublictips-close" href="#nogo" title=""></a>
            <div class="line1">亲，请先选择要删除的宝贝或店铺～</div>
            <div class="line2">
                <a class="J_FPublicTips_OK fpublictips-btn bg-red not" href="#nogo" title="">确 定</a>
            </div>
        </div>
    </div>
    <div id="ks-component354" class="fpublictips-overlay" style="width: 328px; height: 179px; z-index: 20010; left: 786.5px; top: 168.01px; display: none;">
        <div id="ks-content-ks-component354" class="fpublictips-overlay-content">
            <a class="J_FPublicTips_Close fpublictips-close" href="#nogo" title=""></a>
            <div class="line1">确定删除？</div>
            <div class="line2">
                <a class="J_FPublicTips_OK fpublictips-btn bg-red ok" href="#nogo" title="">确 定</a>
                <a class="J_FPublicTips_Close fpublictips-btn not" href="#nogo" title="">取 消</a>
            </div>
        </div>
    </div>
</div>
<!-- tail-->
<jsp:include page="${pageContext.request.contextPath}/public_page/last.html"></jsp:include>
<jsp:include page="/public_page/open_chat.jsp"></jsp:include>
<!-- main end-->
<script type="text/javascript" src="${pageContext.request.contextPath}/static/js/frame/jquery-3.5.1.min.js"></script>
<script>
    $(function() {
        $(".fav-tool-showbtn").click(function () {
            $('.fav-tool-list').show();
            $(this).hide();
            $('.edit-pop').show();
        });

        $('.fav-tool-hidebtn').click(function () {
            $('.fav-tool-list').hide();
            $(".fav-tool-showbtn").show();
            $('.edit-pop').hide();
        });

        $('.edit-pop').click(function () {
            var _this = $(this).find('.edit-icon');
            if (_this.hasClass("edit-k") == true) {
                _this.removeClass("edit-k");
                $('.edit-pop-border').removeClass("ad");
                $('.J_Edit_Pop_Btn').removeClass("ad");
            } else {
                _this.addClass("edit-k");
                $('.J_Edit_Pop_Btn').addClass("ad");
                $('.edit-pop-border').addClass("ad");
            }

        });

        $('.J_SelectAll').click(function () {
            if ($('.J_SelectAll').hasClass("fav-tool-item-selall") == true) {
                $('.J_SelectAll').removeClass("fav-tool-item-selall");
                $('.edit-icon').removeClass("edit-k");
                $('.edit-pop-border').removeClass("ad");
                $('.J_Edit_Pop_Btn').removeClass("ad");
            } else {
                $('.J_SelectAll').addClass("fav-tool-item-selall");
                $('.edit-icon').addClass("edit-k");
                $('.J_Edit_Pop_Btn').addClass("ad");
                $('.edit-pop-border').addClass("ad");
            }

        });

        $(".item").hover(function () {
            $(this).addClass("item-price-box-hover");
        }, function () {
            $(this).removeClass("item-price-box-hover");
        });

        // 点击删除宝贝
        $(".icon-shanchu").click(function () {
            $(this).parents(".J_FavListItem").addClass("del-pop-show");
        });

        // 确定删除
        $(".btn-ok").click(function () {
            var sid = $(this).parents(".J_FavListItem").attr("data-sid");
            $.post("/user_logic/cancelCollectShop.htm", {"sid": sid}, res =>{
                if(res == 'success'){
                    $(this).parents(".J_FavListItem").remove();
                }
            });
        });

        // 取消删除
        $(".btn-close").click(function () {
            $(this).parents(".J_FavListItem").removeClass("del-pop-show");
        })

        // 点击批量删除，如果没有选中，则提示
        $(".J_DeleteItems").click(function () {
            var length = $(".edit-k").length;
            if (length == 0) {
                $("#ks-component353").fadeIn(400);
                return false;
            }
            $("#ks-component354").fadeIn(400);
        });

        // 关闭框
        $(".not, .fpublictips-close").click(function () {
            $(".fpublictips-overlay").fadeOut(400);
        });

        // 确认批量删除
        $(".ok").click(function () {
            var clids = new Array();
            $(".edit-k").each(function () {
                clids.push($(this).parents(".J_FavListItem").attr("data-clid"));
            });
            $.post("/user_logic/batchReduceShopCollectCount.htm", {"clids": clids}, function (res) {
                if (res == "success") {
                    $(".edit-k").each(function () {
                        $(this).parents(".J_FavListItem").remove();
                        $(".fpublictips-overlay").fadeOut(400);
                    });
                }
            })
        });
    });
</script>
</body>
</html>
